<?php

/**
 * This is the model class for table "other".
 *
 * The followings are the available columns in table 'other':
 * @property integer $id
 * @property integer $student_id
 * @property string $job_objective_ja
 * @property string $job_objective
 * @property string $com_back_ja
 * @property string $com_back
 * @property string $note_ja
 * @property string $note
 * @property string $admiss_purpose_ja
 * @property string $admiss_purpose
 */
class Other extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'other';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id, student_id', 'numerical', 'integerOnly'=>true),
			array('job_objective_ja, job_objective, com_back_ja, com_back, note_ja, note, admiss_purpose_ja, admiss_purpose', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id, student_id, job_objective_ja, job_objective, com_back_ja, com_back, note_ja, note, admiss_purpose_ja, admiss_purpose', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'student_id' => 'Student',
			'job_objective_ja' => 'Job Objective Ja',
			'job_objective' => 'Job Objective',
			'com_back_ja' => 'Com Back Ja',
			'com_back' => 'Com Back',
			'note_ja' => 'Note Ja',
			'note' => 'Note',
			'admiss_purpose_ja' => 'Admiss Purpose Ja',
			'admiss_purpose' => 'Admiss Purpose',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('student_id',$this->student_id);
		$criteria->compare('job_objective_ja',$this->job_objective_ja,true);
		$criteria->compare('job_objective',$this->job_objective,true);
		$criteria->compare('com_back_ja',$this->com_back_ja,true);
		$criteria->compare('com_back',$this->com_back,true);
		$criteria->compare('note_ja',$this->note_ja,true);
		$criteria->compare('note',$this->note,true);
		$criteria->compare('admiss_purpose_ja',$this->admiss_purpose_ja,true);
		$criteria->compare('admiss_purpose',$this->admiss_purpose,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return Other the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
